package edu.sctu.wangxiaoqiang.day20150609.util;



import edu.sctu.wangxiaoqiang.day20150609.appbean.PeopleAppbean;

import java.util.HashMap;

/**
 * Created by user25 on 2015/6/9.
 */
public class CardDeth {

    private HashMap <String,Integer> map;
    public CardDeth(){}
    public CardDeth(HashMap<String,Integer> map){
        this.map = map;
    }
    public int  getCount(String start,String end){
        boolean count = false;
        int count1 = 1;
        if(((Integer)this.map.get(start)).intValue() >((Integer)this.map.get(end)).intValue() ){
           count1 =  ((Integer)this.map.get(start)).intValue() - ((Integer)this.map.get(end)).intValue();
        }else{
           count1 = ((Integer)this.map.get(end)).intValue() - ((Integer)this.map.get(start)).intValue();
        }
        return count1;
    }
    public int getPrice(String start,String end){
        byte price = 2;
        if(this.getCount(start,end)<3){
            price = 2;
        }else if(this.getCount(start,end)>=3 && this.getCount(start,end)<6){
            price = 4;
        }else  if(this.getCount(start,end)>=6 && this.getCount(start,end)<8){
            price = 5;
        }else if(this.getCount(start,end)>=8){
            price = 6;
        }
        return price ;
    }

    public void setPrice(int price,PeopleAppbean peopleAppbean){

            peopleAppbean.setPrice(peopleAppbean.getPrice() + price);

    }


}
